
import java.awt.Image;
import java.awt.event.ActionEvent;
import java.awt.event.ActionListener;
import java.io.BufferedReader;
import java.io.File;
import java.io.FileOutputStream;
import java.io.IOException;
import java.io.InputStream;
import java.io.InputStreamReader;
import java.io.OutputStream;
import java.net.MalformedURLException;
import java.net.URISyntaxException;
import java.net.URL;
import java.net.URLEncoder;
import java.sql.ResultSet;
import java.sql.SQLException;
import java.text.ParseException;
import java.text.SimpleDateFormat;
import java.util.ArrayList;
import java.util.Date;
import java.util.logging.Level;
import java.util.logging.Logger;
import javax.swing.DefaultComboBoxModel;
import javax.swing.ImageIcon;
import javax.swing.JComboBox;
import javax.swing.JOptionPane;
import javax.xml.parsers.ParserConfigurationException;
import javax.xml.xpath.XPath;
import javax.xml.xpath.XPathConstants;
import javax.xml.xpath.XPathExpression;
import javax.xml.xpath.XPathExpressionException;
import javax.xml.xpath.XPathFactory;
import org.htmlcleaner.CleanerProperties;
import org.htmlcleaner.DomSerializer;
import org.htmlcleaner.HtmlCleaner;
import org.htmlcleaner.TagNode;
import org.w3c.dom.Document;
import org.w3c.dom.Node;
import org.w3c.dom.NodeList;
import java.lang.*;
import java.util.Calendar;

/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */
/**
 *
 * @author Tan Le Anh
 */
public class Main extends javax.swing.JFrame {

    /**
     * Creates new form Main
     */
    public Main() throws Exception {
        initComponents();
        LoadDataUrl();
    }

    /**
     * This method is called from within the constructor to initialize the form.
     * WARNING: Do NOT modify this code. The content of this method is always
     * regenerated by the Form Editor.
     */
    @SuppressWarnings("unchecked")
    // <editor-fold defaultstate="collapsed" desc="Generated Code">//GEN-BEGIN:initComponents
    private void initComponents() {

        jTabbedPane6 = new javax.swing.JTabbedPane();
        label1 = new java.awt.Label();
        jFrame1 = new javax.swing.JFrame();
        jFrame2 = new javax.swing.JFrame();
        jPanel3 = new javax.swing.JPanel();
        jLabel1 = new javax.swing.JLabel();
        jLabel2 = new javax.swing.JLabel();
        jLabel3 = new javax.swing.JLabel();
        txtlinkchude = new javax.swing.JTextField();
        txtlink = new javax.swing.JTextField();
        txttitle = new javax.swing.JTextField();
        txtdate = new javax.swing.JTextField();
        txtdes = new javax.swing.JTextField();
        txtnextlink = new javax.swing.JTextField();
        btntaomoi = new javax.swing.JButton();
        jLabel8 = new javax.swing.JLabel();
        txtlinkweb = new javax.swing.JTextField();
        jLabel5 = new javax.swing.JLabel();
        txtimage = new javax.swing.JTextField();
        txtcurentlink = new javax.swing.JTextField();
        cbourl2 = new javax.swing.JComboBox();
        jLabel21 = new javax.swing.JLabel();
        jLabel4 = new javax.swing.JLabel();
        jLabel6 = new javax.swing.JLabel();
        jLabel7 = new javax.swing.JLabel();
        jLabel12 = new javax.swing.JLabel();
        jPanel6 = new javax.swing.JPanel();
        jLabel13 = new javax.swing.JLabel();
        cbourl1 = new javax.swing.JComboBox();
        cbocategory1 = new javax.swing.JComboBox();
        btnxemtin = new javax.swing.JButton();
        jLabel14 = new javax.swing.JLabel();
        jLabel15 = new javax.swing.JLabel();
        cbotitle = new javax.swing.JComboBox();
        jPanel1 = new javax.swing.JPanel();
        jLabel16 = new javax.swing.JLabel();
        jLabel17 = new javax.swing.JLabel();
        jLabel18 = new javax.swing.JLabel();
        jLabel19 = new javax.swing.JLabel();
        jLabel20 = new javax.swing.JLabel();
        lbhinhanh = new javax.swing.JLabel();
        txtdiachi = new javax.swing.JTextField();
        txttuade = new javax.swing.JTextField();
        txtngaygio = new javax.swing.JTextField();
        jScrollPane1 = new javax.swing.JScrollPane();
        txtmota = new javax.swing.JTextArea();
        btnXoa = new javax.swing.JButton();
        jPanel5 = new javax.swing.JPanel();
        cbourl = new javax.swing.JComboBox();
        cbocategory = new javax.swing.JComboBox();
        btlaytin = new javax.swing.JButton();
        jLabel9 = new javax.swing.JLabel();
        jLabel10 = new javax.swing.JLabel();
        pinLimit = new javax.swing.JSpinner();
        jLabel11 = new javax.swing.JLabel();
        jPanel7 = new javax.swing.JPanel();
        cbourl3 = new javax.swing.JComboBox();
        btThemChuDe = new javax.swing.JButton();
        txtTenChuDe = new javax.swing.JTextField();
        jLabel24 = new javax.swing.JLabel();
        txtDiaChiChuDe = new javax.swing.JTextField();
        jLabel23 = new javax.swing.JLabel();
        jLabel22 = new javax.swing.JLabel();

        label1.setText("label1");

        javax.swing.GroupLayout jFrame1Layout = new javax.swing.GroupLayout(jFrame1.getContentPane());
        jFrame1.getContentPane().setLayout(jFrame1Layout);
        jFrame1Layout.setHorizontalGroup(
            jFrame1Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
            .addGap(0, 400, Short.MAX_VALUE)
        );
        jFrame1Layout.setVerticalGroup(
            jFrame1Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
            .addGap(0, 300, Short.MAX_VALUE)
        );

        javax.swing.GroupLayout jFrame2Layout = new javax.swing.GroupLayout(jFrame2.getContentPane());
        jFrame2.getContentPane().setLayout(jFrame2Layout);
        jFrame2Layout.setHorizontalGroup(
            jFrame2Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
            .addGap(0, 400, Short.MAX_VALUE)
        );
        jFrame2Layout.setVerticalGroup(
            jFrame2Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
            .addGap(0, 300, Short.MAX_VALUE)
        );

        setDefaultCloseOperation(javax.swing.WindowConstants.EXIT_ON_CLOSE);

        jPanel3.setBorder(javax.swing.BorderFactory.createTitledBorder("Ánh xạ"));

        jLabel1.setText("XPath chủ đề:");

        jLabel2.setText("XPath link:");

        jLabel3.setText("XPath title:");

        txtlinkchude.setText("//li[contains(@id,'mnu')]/a[1]");

        txtlink.setText("//*[@class='blogshare_listingOne' or @class='listItemGrNewsBox']//a[@id='divFileRandom_1' or @class='clorBlue']");
        txtlink.setToolTipText("");

        txttitle.setText("//*[@class='f-26 clorBlue padT10' or @class='pTitle']");

        txtdate.setText("//div[@class='padT10']/div[@class='fLeft']");

        txtdes.setText("//*[@class='pBody' or @class='pHead']");

        txtnextlink.setText("//div[contains(@class,'pagging')]/a");

        btntaomoi.setText("Tạo mới");
        btntaomoi.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
                btntaomoiActionPerformed(evt);
            }
        });

        jLabel8.setText("Địa chỉ website:");

        txtlinkweb.setText("http://tuoitre.vn/");

        jLabel5.setText("XPath image:");

        txtimage.setText("//img[@class='imgNoSlide-image']");

        txtcurentlink.setText("//div[contains(@class,'pagging')]/a[contains(@class,'selected')]");

        cbourl2.setLightWeightPopupEnabled(false);

        jLabel21.setText("Website:");

        jLabel4.setText("XPath date&time:");

        jLabel6.setText("XPath description:");

        jLabel7.setText("XPath next page:");

        jLabel12.setText("XPath curent page:");

        javax.swing.GroupLayout jPanel3Layout = new javax.swing.GroupLayout(jPanel3);
        jPanel3.setLayout(jPanel3Layout);
        jPanel3Layout.setHorizontalGroup(
            jPanel3Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.TRAILING)
            .addGroup(jPanel3Layout.createSequentialGroup()
                .addContainerGap(82, Short.MAX_VALUE)
                .addGroup(jPanel3Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.TRAILING)
                    .addGroup(jPanel3Layout.createSequentialGroup()
                        .addGroup(jPanel3Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.TRAILING)
                            .addComponent(jLabel8)
                            .addComponent(jLabel2)
                            .addComponent(jLabel1)
                            .addComponent(jLabel3)
                            .addComponent(jLabel21))
                        .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
                        .addGroup(jPanel3Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING, false)
                            .addComponent(txtlinkchude, javax.swing.GroupLayout.PREFERRED_SIZE, 310, javax.swing.GroupLayout.PREFERRED_SIZE)
                            .addComponent(txtlink, javax.swing.GroupLayout.PREFERRED_SIZE, 310, javax.swing.GroupLayout.PREFERRED_SIZE)
                            .addComponent(txttitle, javax.swing.GroupLayout.PREFERRED_SIZE, 310, javax.swing.GroupLayout.PREFERRED_SIZE)
                            .addComponent(txtlinkweb, javax.swing.GroupLayout.PREFERRED_SIZE, 310, javax.swing.GroupLayout.PREFERRED_SIZE)
                            .addComponent(cbourl2, javax.swing.GroupLayout.PREFERRED_SIZE, 310, javax.swing.GroupLayout.PREFERRED_SIZE)))
                    .addGroup(jPanel3Layout.createSequentialGroup()
                        .addGroup(jPanel3Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.TRAILING)
                            .addComponent(jLabel5)
                            .addComponent(jLabel4)
                            .addComponent(jLabel6)
                            .addComponent(jLabel7)
                            .addComponent(jLabel12))
                        .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
                        .addGroup(jPanel3Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
                            .addComponent(btntaomoi)
                            .addComponent(txtcurentlink, javax.swing.GroupLayout.PREFERRED_SIZE, 310, javax.swing.GroupLayout.PREFERRED_SIZE)
                            .addComponent(txtdes, javax.swing.GroupLayout.PREFERRED_SIZE, 310, javax.swing.GroupLayout.PREFERRED_SIZE)
                            .addComponent(txtdate, javax.swing.GroupLayout.PREFERRED_SIZE, 310, javax.swing.GroupLayout.PREFERRED_SIZE)
                            .addComponent(txtnextlink, javax.swing.GroupLayout.PREFERRED_SIZE, 310, javax.swing.GroupLayout.PREFERRED_SIZE)
                            .addComponent(txtimage, javax.swing.GroupLayout.PREFERRED_SIZE, 310, javax.swing.GroupLayout.PREFERRED_SIZE))))
                .addGap(24, 24, 24))
        );
        jPanel3Layout.setVerticalGroup(
            jPanel3Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
            .addGroup(javax.swing.GroupLayout.Alignment.TRAILING, jPanel3Layout.createSequentialGroup()
                .addContainerGap(javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)
                .addGroup(jPanel3Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
                    .addComponent(cbourl2, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
                    .addComponent(jLabel21))
                .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.UNRELATED)
                .addGroup(jPanel3Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
                    .addComponent(jLabel8)
                    .addComponent(txtlinkweb, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE))
                .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.UNRELATED)
                .addGroup(jPanel3Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
                    .addComponent(jLabel1)
                    .addComponent(txtlinkchude, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE))
                .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.UNRELATED)
                .addGroup(jPanel3Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
                    .addComponent(jLabel2)
                    .addComponent(txtlink, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE))
                .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.UNRELATED)
                .addGroup(jPanel3Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
                    .addComponent(jLabel3)
                    .addComponent(txttitle, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE))
                .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.UNRELATED)
                .addGroup(jPanel3Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
                    .addComponent(txtimage, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
                    .addComponent(jLabel5))
                .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.UNRELATED)
                .addGroup(jPanel3Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
                    .addComponent(txtdate, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
                    .addComponent(jLabel4))
                .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.UNRELATED)
                .addGroup(jPanel3Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
                    .addComponent(txtdes, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
                    .addComponent(jLabel6))
                .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.UNRELATED)
                .addGroup(jPanel3Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
                    .addComponent(txtnextlink, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
                    .addComponent(jLabel7))
                .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.UNRELATED)
                .addGroup(jPanel3Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
                    .addComponent(txtcurentlink, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
                    .addComponent(jLabel12))
                .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.UNRELATED)
                .addComponent(btntaomoi)
                .addGap(27, 27, 27))
        );

        jPanel6.setBorder(javax.swing.BorderFactory.createTitledBorder("Xem tin"));

        jLabel13.setText("Website:");

        cbourl1.setLightWeightPopupEnabled(false);

        btnxemtin.setText("Xem tin");
        btnxemtin.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
                btnxemtinActionPerformed(evt);
            }
        });

        jLabel14.setText("Chủ đề:");

        jLabel15.setText("Tựa đề:");

        cbotitle.setLightWeightPopupEnabled(false);

        jPanel1.setBorder(javax.swing.BorderFactory.createTitledBorder("Thông tin chi tiết"));

        jLabel16.setText("Địa chỉ:");

        jLabel17.setText("Tựa đề:");

        jLabel18.setText("Ngày và giờ: ");

        jLabel19.setText("Hình ảnh:");

        jLabel20.setText("Mô tả:");

        lbhinhanh.setBorder(javax.swing.BorderFactory.createLineBorder(new java.awt.Color(0, 0, 0)));

        txtmota.setColumns(20);
        txtmota.setLineWrap(true);
        txtmota.setRows(5);
        jScrollPane1.setViewportView(txtmota);

        javax.swing.GroupLayout jPanel1Layout = new javax.swing.GroupLayout(jPanel1);
        jPanel1.setLayout(jPanel1Layout);
        jPanel1Layout.setHorizontalGroup(
            jPanel1Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
            .addGroup(jPanel1Layout.createSequentialGroup()
                .addContainerGap()
                .addGroup(jPanel1Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
                    .addComponent(jScrollPane1, javax.swing.GroupLayout.Alignment.TRAILING)
                    .addGroup(jPanel1Layout.createSequentialGroup()
                        .addGroup(jPanel1Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
                            .addComponent(jLabel17)
                            .addComponent(jLabel16)
                            .addComponent(jLabel18))
                        .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
                        .addGroup(jPanel1Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
                            .addComponent(txtngaygio)
                            .addComponent(txtdiachi)
                            .addComponent(txttuade)))
                    .addGroup(jPanel1Layout.createSequentialGroup()
                        .addGroup(jPanel1Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
                            .addComponent(jLabel20)
                            .addComponent(jLabel19)
                            .addComponent(lbhinhanh, javax.swing.GroupLayout.PREFERRED_SIZE, 268, javax.swing.GroupLayout.PREFERRED_SIZE))
                        .addGap(0, 0, Short.MAX_VALUE)))
                .addContainerGap())
        );
        jPanel1Layout.setVerticalGroup(
            jPanel1Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
            .addGroup(jPanel1Layout.createSequentialGroup()
                .addContainerGap()
                .addGroup(jPanel1Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
                    .addComponent(jLabel16)
                    .addComponent(txtdiachi, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE))
                .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
                .addGroup(jPanel1Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
                    .addComponent(jLabel17)
                    .addComponent(txttuade, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE))
                .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
                .addGroup(jPanel1Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
                    .addComponent(jLabel18)
                    .addComponent(txtngaygio, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE))
                .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
                .addComponent(jLabel19)
                .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
                .addComponent(lbhinhanh, javax.swing.GroupLayout.PREFERRED_SIZE, 151, javax.swing.GroupLayout.PREFERRED_SIZE)
                .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
                .addComponent(jLabel20)
                .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
                .addComponent(jScrollPane1)
                .addContainerGap())
        );

        btnXoa.setText("Xóa tin");
        btnXoa.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
                btnXoaActionPerformed(evt);
            }
        });

        javax.swing.GroupLayout jPanel6Layout = new javax.swing.GroupLayout(jPanel6);
        jPanel6.setLayout(jPanel6Layout);
        jPanel6Layout.setHorizontalGroup(
            jPanel6Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
            .addGroup(jPanel6Layout.createSequentialGroup()
                .addContainerGap()
                .addGroup(jPanel6Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
                    .addGroup(jPanel6Layout.createSequentialGroup()
                        .addGroup(jPanel6Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.TRAILING)
                            .addComponent(jLabel15)
                            .addComponent(jLabel13))
                        .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
                        .addGroup(jPanel6Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
                            .addGroup(jPanel6Layout.createSequentialGroup()
                                .addComponent(cbotitle, 0, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)
                                .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.UNRELATED)
                                .addComponent(btnxemtin)
                                .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
                                .addComponent(btnXoa))
                            .addGroup(jPanel6Layout.createSequentialGroup()
                                .addComponent(cbourl1, javax.swing.GroupLayout.PREFERRED_SIZE, 330, javax.swing.GroupLayout.PREFERRED_SIZE)
                                .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
                                .addComponent(jLabel14)
                                .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
                                .addComponent(cbocategory1, 0, 274, Short.MAX_VALUE))))
                    .addComponent(jPanel1, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE))
                .addContainerGap())
        );
        jPanel6Layout.setVerticalGroup(
            jPanel6Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
            .addGroup(jPanel6Layout.createSequentialGroup()
                .addContainerGap()
                .addGroup(jPanel6Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
                    .addComponent(cbourl1, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
                    .addComponent(jLabel13)
                    .addComponent(jLabel14)
                    .addComponent(cbocategory1, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE))
                .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
                .addGroup(jPanel6Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
                    .addComponent(jLabel15)
                    .addComponent(cbotitle, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
                    .addComponent(btnxemtin)
                    .addComponent(btnXoa))
                .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
                .addComponent(jPanel1, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)
                .addContainerGap())
        );

        jPanel5.setBorder(javax.swing.BorderFactory.createTitledBorder("Lấy tin"));

        cbourl.setLightWeightPopupEnabled(false);

        btlaytin.setText("Lấy tin");
        btlaytin.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
                btlaytinActionPerformed(evt);
            }
        });

        jLabel9.setText("Website:");

        jLabel10.setText("Chủ đề");

        pinLimit.setValue(1);

        jLabel11.setText("Số trang:");

        javax.swing.GroupLayout jPanel5Layout = new javax.swing.GroupLayout(jPanel5);
        jPanel5.setLayout(jPanel5Layout);
        jPanel5Layout.setHorizontalGroup(
            jPanel5Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
            .addGroup(jPanel5Layout.createSequentialGroup()
                .addContainerGap(javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)
                .addGroup(jPanel5Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.TRAILING)
                    .addComponent(jLabel10)
                    .addComponent(jLabel9)
                    .addComponent(jLabel11))
                .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
                .addGroup(jPanel5Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING, false)
                    .addComponent(pinLimit, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
                    .addComponent(btlaytin)
                    .addComponent(cbourl, 0, 159, Short.MAX_VALUE)
                    .addComponent(cbocategory, 0, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE))
                .addGap(59, 59, 59))
        );
        jPanel5Layout.setVerticalGroup(
            jPanel5Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
            .addGroup(jPanel5Layout.createSequentialGroup()
                .addGroup(jPanel5Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
                    .addComponent(cbourl, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
                    .addComponent(jLabel9))
                .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.UNRELATED)
                .addGroup(jPanel5Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
                    .addComponent(cbocategory, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
                    .addComponent(jLabel10))
                .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.UNRELATED)
                .addGroup(jPanel5Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
                    .addComponent(pinLimit, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
                    .addComponent(jLabel11))
                .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)
                .addComponent(btlaytin))
        );

        jPanel7.setBorder(javax.swing.BorderFactory.createTitledBorder("Thêm chủ đề"));

        cbourl3.setLightWeightPopupEnabled(false);

        btThemChuDe.setText("Thêm");
        btThemChuDe.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
                btThemChuDeActionPerformed(evt);
            }
        });

        jLabel24.setText("Địa chỉ chủ đề:");

        jLabel23.setText("Tên chủ đề:");

        jLabel22.setText("Website:");

        javax.swing.GroupLayout jPanel7Layout = new javax.swing.GroupLayout(jPanel7);
        jPanel7.setLayout(jPanel7Layout);
        jPanel7Layout.setHorizontalGroup(
            jPanel7Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
            .addGroup(jPanel7Layout.createSequentialGroup()
                .addContainerGap()
                .addGroup(jPanel7Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.TRAILING)
                    .addComponent(jLabel24)
                    .addComponent(jLabel23)
                    .addComponent(jLabel22))
                .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
                .addGroup(jPanel7Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING, false)
                    .addComponent(btThemChuDe)
                    .addComponent(cbourl3, 0, 159, Short.MAX_VALUE)
                    .addComponent(txtTenChuDe)
                    .addComponent(txtDiaChiChuDe))
                .addContainerGap(javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE))
        );
        jPanel7Layout.setVerticalGroup(
            jPanel7Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
            .addGroup(jPanel7Layout.createSequentialGroup()
                .addGap(5, 5, 5)
                .addGroup(jPanel7Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
                    .addComponent(cbourl3, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
                    .addComponent(jLabel22))
                .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.UNRELATED)
                .addGroup(jPanel7Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
                    .addComponent(txtTenChuDe, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
                    .addComponent(jLabel23))
                .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
                .addGroup(jPanel7Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
                    .addComponent(jLabel24)
                    .addComponent(txtDiaChiChuDe, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE))
                .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED, 9, Short.MAX_VALUE)
                .addComponent(btThemChuDe))
        );

        javax.swing.GroupLayout layout = new javax.swing.GroupLayout(getContentPane());
        getContentPane().setLayout(layout);
        layout.setHorizontalGroup(
            layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
            .addGroup(layout.createSequentialGroup()
                .addContainerGap()
                .addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
                    .addGroup(layout.createSequentialGroup()
                        .addComponent(jPanel7, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)
                        .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
                        .addComponent(jPanel5, javax.swing.GroupLayout.PREFERRED_SIZE, 245, javax.swing.GroupLayout.PREFERRED_SIZE))
                    .addComponent(jPanel3, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE))
                .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
                .addComponent(jPanel6, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
                .addContainerGap())
        );
        layout.setVerticalGroup(
            layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
            .addGroup(layout.createSequentialGroup()
                .addContainerGap()
                .addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING, false)
                    .addComponent(jPanel6, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)
                    .addGroup(layout.createSequentialGroup()
                        .addComponent(jPanel3, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
                        .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
                        .addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING, false)
                            .addComponent(jPanel7, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)
                            .addComponent(jPanel5, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE))))
                .addContainerGap(javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE))
        );

        pack();
    }// </editor-fold>//GEN-END:initComponents
    int CategoryId = -1;
    int NewsId = -1;
    int CurrentNewsId = -1;
    String CategoryLink = "";

    private String GetContent(String _url) {
        String inputLine = "";
        try {
            //URL url_tmp = new URL(_url);
            URL url_tmp = new URL(_url);

            String context = url_tmp.getProtocol();
            String hostname = url_tmp.getHost();
            String thePath = url_tmp.getPath();
            int port = url_tmp.getPort();
            thePath = thePath.replaceAll("(^/|/$)", ""); // removes beginning/end slash
            String encodedPath = URLEncoder.encode(thePath, "UTF-8"); // encodes unicode characters
            encodedPath = encodedPath.replace("+", "%20"); // change + to %20 (space)
            encodedPath = encodedPath.replace("%2F", "/"); // change %2F back to slash
            String urlString = context + "://" + hostname + "/" + encodedPath;

            URL url = new URL(urlString);

            BufferedReader in = new BufferedReader(
                    new InputStreamReader(url.openStream()));
            String s = "";
            while ((s = in.readLine()) != null) {
                inputLine += s;
            }

            in.close();
        } catch (MalformedURLException mue) {
            System.out.println("Check your URL");
        } catch (IOException ioe) {
            System.out.println("Check your IO stream" + ioe.getMessage());
        }
        return inputLine;
    }

    private org.w3c.dom.Document Convert(String Html) throws ParserConfigurationException {
        TagNode tagNode = new HtmlCleaner().clean(Html);
        org.w3c.dom.Document doc = new DomSerializer(
                new CleanerProperties()).createDOM(tagNode);
        return doc;
    }

    private NodeList GetCategoryLink() {
        XPathFactory xPathfactory = XPathFactory.newInstance();
        XPath xpath = xPathfactory.newXPath();
        XPathExpression expr;
        NodeList nl = null;
        try {
            expr = xpath.compile(txtlinkchude.getText());//lay link

            nl = (NodeList) expr.evaluate(Convert(GetContent(txtlinkweb.getText())), XPathConstants.NODESET);
        } catch (XPathExpressionException ex) {
            JOptionPane.showMessageDialog(null, ex.getMessage());
        } catch (ParserConfigurationException ex) {
            JOptionPane.showMessageDialog(null, ex.getMessage());
        }
        return nl;
    }

    private ArrayList<String> GetNewsLink(String CategorkLink, String XpathLink) {
        XPathFactory xPathfactory = XPathFactory.newInstance();
        XPath xpath = xPathfactory.newXPath();
        XPathExpression expr;
        ArrayList<String> ListLink = new ArrayList<String>();
        try {
            expr = xpath.compile(XpathLink);//lay link

            NodeList nl = (NodeList) expr.evaluate(Convert(GetContent(CategorkLink)), XPathConstants.NODESET);

            for (int i = 0; i < nl.getLength(); i++) {
                Node currentItem = nl.item(i);
                String key = currentItem.getAttributes().getNamedItem("href").getNodeValue();
                if (!key.contains("http://")) {
                    String s = "";
                    if (CategorkLink.contains("www.")) {
                        s = "www.";
                    }
                    String domain = CategorkLink.replaceAll("http://", "").replaceAll("www.", "").split("/")[0];
                    key = "http://" + s + domain + key;
                }
                ListLink.add(key);
            }
        } catch (XPathExpressionException ex) {
            JOptionPane.showMessageDialog(null, ex.getMessage());
        } catch (ParserConfigurationException ex) {
            JOptionPane.showMessageDialog(null, ex.getMessage());
        }
        return ListLink;
    }

    private String GetNewsTitle(Document d, String XpathTitle) {
        XPathFactory xPathfactory = XPathFactory.newInstance();
        XPath xpath = xPathfactory.newXPath();
        XPathExpression expr;
        String title = "";
        try {
            expr = xpath.compile(XpathTitle);//lay title

            NodeList nl = (NodeList) expr.evaluate(d, XPathConstants.NODESET);
            if (nl.getLength() > 0) {
                title = nl.item(0).getTextContent();
            }
        } catch (XPathExpressionException ex) {
            JOptionPane.showMessageDialog(null, ex.getMessage());
        }
        return title;
    }

    private String GetNewsImage(Document d, String Xpathimage) throws URISyntaxException {
        XPathFactory xPathfactory = XPathFactory.newInstance();
        XPath xpath = xPathfactory.newXPath();
        XPathExpression expr;
        String Image = "";
        String base_url = CategoryLink;
        base_url = base_url.replaceAll("http://", "").replaceAll("www.", "").split("/")[0];
        try {
            expr = xpath.compile(Xpathimage);//lay anh

            NodeList nl = (NodeList) expr.evaluate(d, XPathConstants.NODESET);

            if (nl.getLength() > 0) {
                Node currentItem = nl.item(0);
                String key = currentItem.getAttributes().getNamedItem("src").getNodeValue();
                if (!key.contains("http://")) {
                    if (CategoryLink.contains("www.")) {
                        key = "http://www." + base_url + key;
                    } else {
                        key = "http://" + base_url + key;
                    }
                }
                //System.out.println(key);
                //luu anh
                URL url = new URL(key);
                OutputStream os;
                Date date = new Date();
                SimpleDateFormat df = new SimpleDateFormat("yyyyMMddHHmmss");
                Image = df.format(date) + ".jpg";
                try (InputStream is = url.openStream()) {
                    final File f = new File(Main.class.getProtectionDomain().getCodeSource().getLocation().getPath());
                    //final File f = new File(".");
                    os = new FileOutputStream(f.getPath().replace("%20", " ") + "/../../Images/" + Image);
                    //os = new FileOutputStream("../Images/"+Image+".jpg");
                    byte[] b = new byte[2048];
                    int length;
                    while ((length = is.read(b)) != -1) {
                        os.write(b, 0, length);
                    }
                }
                os.close();
            }
        } catch (XPathExpressionException ex) {
            JOptionPane.showMessageDialog(null, ex.getMessage());
        } catch (MalformedURLException ex) {
            Logger.getLogger(Main.class.getName()).log(Level.SEVERE, null, ex);
        } catch (IOException ex) {
            Logger.getLogger(Main.class.getName()).log(Level.SEVERE, null, ex);
        }
        return Image;
    }

    private Date GetNewsDateTime(Document d, String Xpathdate) {
        XPathFactory xPathfactory = XPathFactory.newInstance();
        XPath xpath = xPathfactory.newXPath();
        XPathExpression expr;
        Date date = null;
        try {
            expr = xpath.compile(Xpathdate);//lay ngay va gio

            NodeList nl = (NodeList) expr.evaluate(d, XPathConstants.NODESET);
            if (nl.getLength() > 0) {
                SimpleDateFormat df = new SimpleDateFormat("dd/MM/yyyy HH:mm");
                String key = nl.item(0).getTextContent();
                if (key.contains(",")) {
                    key = key.split(",")[1].trim();
                }
                date = df.parse(key);
            }
            //System.out.println(df.format(date));
        } catch (XPathExpressionException ex) {
            System.out.println(ex.getMessage());
        } catch (ParseException ex) {
            System.out.println(ex.getMessage());
        }
        return date;
    }

    private String GetNewsDescription(Document d, String Xpathdes) {
        XPathFactory xPathfactory = XPathFactory.newInstance();
        XPath xpath = xPathfactory.newXPath();
        XPathExpression expr;
        String des = "";
        try {
            expr = xpath.compile(Xpathdes);//lay contend

            NodeList nl = (NodeList) expr.evaluate(d, XPathConstants.NODESET);

            for (int i = 0; i < nl.getLength(); i++) {
                Node currentItem = nl.item(i);
                des += currentItem.getTextContent();
                des += "\n";
            }
            //System.out.println(des);
        } catch (XPathExpressionException ex) {
            JOptionPane.showMessageDialog(null, ex.getMessage());
        }
        return des;
    }

    private void AnhXa() throws Exception {
        Connect cn = new Connect();
        ResultSet rs;
        String sql;
        int _urlid;
        String url = txtlinkweb.getText();
        url = url.replaceAll("http://", "").replaceAll("www.", "").split("/")[0];

        //check exist
        sql = "select urlid from url where address like '%" + url + "%'";
        rs = cn.execQuery(sql);
        rs.next();
        int size = rs.getRow();
        if (size <= 0) {
            //insert url
            sql = "insert url(address) values(N'" + txtlinkweb.getText() + "')";
            cn.exec(sql);

            //get id new url
            sql = "select urlid from url where address like '%" + url + "%'";
            rs = cn.execQuery(sql);
            rs.next();
            _urlid = rs.getInt(1);
            //insert xpath
            sql = "insert xpath(xlink,xtitle,ximage,xdate,xdescription,xnextlink,xcurentlink,xcategory,urlid) "
                    + "values('" + txtlink.getText().replace("'", "''")
                    + "','" + txttitle.getText().replace("'", "''")
                    + "','" + txtimage.getText().replace("'", "''")
                    + "','" + txtdate.getText().replace("'", "''")
                    + "','" + txtdes.getText().replace("'", "''")
                    + "','" + txtnextlink.getText().replace("'", "''")
                    + "','" + txtcurentlink.getText().replace("'", "''")
                    + "','" + txtlinkchude.getText().replace("'", "''")
                    + "','" + _urlid + "')";
            cn.exec(sql);
        } else {

            _urlid = rs.getInt(1);
            //update address
            sql = "update url set address='" + txtlinkweb.getText() + "' where urlid=" + _urlid;
            cn.exec(sql);

            //update xpath
            sql = "update xpath set "
                    + "xlink='" + txtlink.getText().replace("'", "''") + "',"
                    + "xtitle='" + txttitle.getText().replace("'", "''") + "',"
                    + "ximage='" + txtimage.getText().replace("'", "''") + "',"
                    + "xdate='" + txtdate.getText().replace("'", "''") + "',"
                    + "xnextlink='" + txtnextlink.getText().replace("'", "''") + "',"
                    + "xcurentlink='" + txtcurentlink.getText().replace("'", "''") + "',"
                    + "xcategory='" + txtlinkchude.getText().replace("'", "''") + "',"
                    + "xdescription='" + txtdes.getText().replace("'", "''") + "' "//have space
                    + "where urlid=" + _urlid;
            cn.exec(sql);
        }
        //kiem tra link co chua wwww.
        if (txtlinkweb.getText().contains("www.")) {
            url = "http://www." + url;
        } else {
            url = "http://" + url;
        }

        //insert or update category
        NodeList nl = GetCategoryLink();
        for (int i = 0; i < nl.getLength(); i++) {
            Node currentItem = nl.item(i);
            String link = currentItem.getAttributes().getNamedItem("href").getNodeValue();//lay link chu de
            String name = currentItem.getTextContent();//lay ten chu de
            //luu vao csdl
            sql = "select categoryid from category where urlid='" + _urlid + "' and name like '%" + name + "%'";
            rs = cn.execQuery(sql);

            if (rs.next()) {
                if (link.contains("http://")) {
                    sql = "update category set "
                            + "link='" + link + "' " //have space
                            + "where urlid=" + _urlid
                            + " and name like '%" + name + "%'";
                } else {
                    sql = "update category set "
                            + "link='" + url + link + "' " //have space
                            + "where urlid=" + _urlid
                            + " and name like '%" + name + "%'";
                }
            } else {
                if (link.contains("http://")) {
                    sql = "insert category(name,link,urlid) values(N'" + name + "',N'" + link
                            + "','" + _urlid + "')";
                } else {
                    sql = "insert category(name,link,urlid) values(N'" + name + "',N'"
                            + url + link + "','" + _urlid + "')";
                }
            }
            cn.exec(sql);

        }
        cn.close();
        rs.close();
    }

    private void LoadDataUrl() throws Exception//lay du lieu nap vao combobox
    {
        Connect cn = null;
        ResultSet rs = null;
        try //lay du lieu nap vao combobox
        {
            cn = new Connect();
            String sql = "select * from url";

            // reset 2 combobox WebLink
            JComboBox cb = new JComboBox();
            JComboBox cb1 = new JComboBox();
            DefaultComboBoxModel cbb = (DefaultComboBoxModel) cb.getModel();

            try {
                rs = cn.execQuery(sql);
                while (rs.next()) {
                    cbb.addElement(new UrlItem(rs.getInt(1), rs.getString(2)));
                }

                //set lai data cho 2 combobox WebLink
                cbourl.setModel(cbb);
                cbourl1.setModel(cbb);
                cbourl2.setModel(cbb);
                cbourl3.setModel(cbb);
            } catch (Exception ex) {
                JOptionPane.showMessageDialog(null, ex.getMessage());
            } finally {
                rs.close();
            }

            //do du lieu cho cbo category voi link dau tien cua cbo url
            if (cbourl.getItemCount() > 0) {
                UrlItem item = (UrlItem) cbourl.getItemAt(0);
                LoadDataCate(item.getValue());
                LoadDataCate1(item.getValue());

                //lang nghe su kien
                cbourl.addActionListener(new ActionListener() {
                    public void actionPerformed(ActionEvent event) {
                        JComboBox comboBox = (JComboBox) event.getSource();
                        UrlItem selectedItem =
                                (UrlItem) comboBox.getSelectedItem();
                        int urlid = selectedItem.getValue();
                        try {
                            LoadDataCate(urlid);
                        } catch (Exception ex) {
                            JOptionPane.showMessageDialog(null, ex.getMessage());
                        }
                    }
                });

                cbourl1.addActionListener(new ActionListener() {
                    public void actionPerformed(ActionEvent event) {
                        JComboBox comboBox = (JComboBox) event.getSource();
                        UrlItem selectedItem =
                                (UrlItem) comboBox.getSelectedItem();
                        int urlid = selectedItem.getValue();
                        try {
                            LoadDataCate1(urlid);
                        } catch (Exception ex) {
                            JOptionPane.showMessageDialog(null, ex.getMessage());
                        }
                    }
                });

                cbourl2.addActionListener(new ActionListener() {
                    public void actionPerformed(ActionEvent event) {
                        JComboBox comboBox = (JComboBox) event.getSource();
                        UrlItem selectedItem =
                                (UrlItem) comboBox.getSelectedItem();
                        int urlid = selectedItem.getValue();
                        String text = selectedItem.toString();
                        try {
                            LoadXPath(urlid, text);
                        } catch (Exception ex) {
                            JOptionPane.showMessageDialog(null, ex.getMessage());
                        }
                    }
                });
            }
        } catch (Exception ex) {
            JOptionPane.showMessageDialog(null, ex.getMessage());
        } finally {
            cn.close();
        }
    }

    private void LoadDataCate(int _urlid) throws Exception {
        Connect cn = null;
        ResultSet rs = null;
        try //lay du lieu nap vao combobox
        {
            cn = new Connect();
            String sql = "select * from category where urlid=" + _urlid + "";
            rs = cn.execQuery(sql);

            //Tao moi mot combobox
            JComboBox cb = new JComboBox();
            DefaultComboBoxModel cbb = (DefaultComboBoxModel) cb.getModel();
            while (rs.next()) {
                cbb.addElement(new CategoryItem(rs.getInt(1),
                        rs.getString(2), rs.getString(3)));
            }
            //set lai data cho combobox Category get tin
            cbocategory.setModel(cbb);


            if (cbocategory.getItemCount() > 0) {
                CategoryItem item = (CategoryItem) cbocategory.getItemAt(0);
                CategoryLink = item.getLink();
                CategoryId = item.getCategoryid();
            }

            //lang nghe su kien khi chon category
            cbocategory.addActionListener(new ActionListener() {
                public void actionPerformed(ActionEvent event) {
                    JComboBox comboBox = (JComboBox) event.getSource();
                    CategoryItem selectedItem =
                            (CategoryItem) comboBox.getSelectedItem();
                    if (selectedItem != null) {
                        CategoryId = selectedItem.getCategoryid();
                        CategoryLink = selectedItem.getLink();
                        //2 dong tren gay ra loi khi add list cate lan dau
                        btlaytin.setEnabled(true);
                    } else {
                        btlaytin.setEnabled(false);
                    }
                }
            });
        } catch (SQLException ex) {
            JOptionPane.showMessageDialog(null, ex.getMessage());
        } finally {
            rs.close();
            cn.close();
        }
    }

    private void LoadDataCate1(int _urlid) throws Exception {
        Connect cn = null;
        ResultSet rs = null;
        try //lay du lieu nap vao combobox
        {
            cn = new Connect();
            String sql = "select * from category where urlid='" + _urlid + "'";
            rs = cn.execQuery(sql);

            //Tao moi combobox tam
            JComboBox cb = new JComboBox();
            DefaultComboBoxModel cbb = (DefaultComboBoxModel) cb.getModel();
            while (rs.next()) {
                cbb.addElement(new CategoryItem(rs.getInt(1),
                        rs.getString(2), rs.getString(3)));
            }
            //set lai data cho combobox Category show tin
            cbocategory1.setModel(cbb);

            if (cbocategory1.getItemCount() > 0) {
                CategoryItem item = (CategoryItem) cbocategory1.getItemAt(0);
                LoadDataTitle(item.getCategoryid());
            }

            //lang nghe su kien
            cbocategory1.addActionListener(new ActionListener() {
                public void actionPerformed(ActionEvent event) {
                    JComboBox comboBox = (JComboBox) event.getSource();
                    CategoryItem selectedItem =
                            (CategoryItem) comboBox.getSelectedItem();
                    try {
                        LoadDataTitle(selectedItem.getCategoryid());
                    } catch (Exception ex) {
                        Logger.getLogger(Main.class
                                .getName()).log(Level.SEVERE, null, ex);
                    }
                }
            });
        } catch (SQLException ex) {
            JOptionPane.showMessageDialog(null, ex.getMessage());
        } finally {
            rs.close();
            cn.close();
        }
    }

    public void LoadXPath(int _urlid, String text) throws SQLException, Exception {
        Connect cn = null;
        ResultSet rs = null;
        try //lay du lieu nap vao combobox
        {
            cn = new Connect();
            String sql = "select * from xpath where urlid='" + _urlid + "'";
            rs = cn.execQuery(sql);
            rs.next();
            txtlinkweb.setText(text);
            txtlink.setText(rs.getString(2));
            txttitle.setText(rs.getString(3));
            txtimage.setText(rs.getString(4));
            txtdate.setText(rs.getString(5));
            txtdes.setText(rs.getString(6));
            txtnextlink.setText(rs.getString(7));
            txtcurentlink.setText(rs.getString(7));
            txtlinkchude.setText(rs.getString(9));

        } catch (Exception ex) {
            JOptionPane.showMessageDialog(null, ex.getMessage());
        } finally {
            rs.close();
            cn.close();
        }
    }

    private void LoadDataTitle(int _cateid) {
        Connect cn = null;
        ResultSet rs = null;
        try {
            cn = new Connect();
            String sql = "select newsid,title from news where categoryid='" + _cateid + "'";
            rs = cn.execQuery(sql);

            JComboBox cb = new JComboBox();
            DefaultComboBoxModel cbb = (DefaultComboBoxModel) cb.getModel();
            while (rs.next()) {
                cbb.addElement(new UrlItem(rs.getInt(1), rs.getString(2)));
            }
            cbotitle.setModel(cbb);

            if (cbotitle.getItemCount() > 0) {
                UrlItem item = (UrlItem) cbotitle.getItemAt(0);
                NewsId = item.getValue();
            } else {
                cbotitle.addItem(new UrlItem(0, "Không có tin!"));
            }
            //lang nghe su kien
            cbotitle.addActionListener(new ActionListener() {
                public void actionPerformed(ActionEvent event) {
                    JComboBox comboBox = (JComboBox) event.getSource();
                    UrlItem selectedItem =
                            (UrlItem) comboBox.getSelectedItem();
                    NewsId = selectedItem.getValue();
                }
            });
        } catch (SQLException ex) {
            JOptionPane.showMessageDialog(null, ex.getMessage());
        } catch (Exception ex) {
            JOptionPane.showMessageDialog(null, ex.getMessage());
        } finally {
            try {
                rs.close();
                cn.close();
            } catch (SQLException ex) {
                Logger.getLogger(Main.class.getName()).log(Level.SEVERE, null, ex);
            } catch (Exception ex) {
                Logger.getLogger(Main.class.getName()).log(Level.SEVERE, null, ex);
            }
        }
    }

    private ArrayList<String> GetXPath() throws SQLException, Exception {
        //lay xlink
        Connect cn = new Connect();
        UrlItem selectedItem =
                (UrlItem) cbourl.getSelectedItem();
        int urlid = selectedItem.getValue();
        String sql = "select * from xpath where urlid='" + urlid + "'";
        ResultSet rs = cn.execQuery(sql);
        rs.next();
        ArrayList<String> xpath = new ArrayList<>();
        xpath.add(rs.getString(2));
        xpath.add(rs.getString(3));
        xpath.add(rs.getString(4));
        xpath.add(rs.getString(5));
        xpath.add(rs.getString(6));
        xpath.add(rs.getString(7));
        xpath.add(rs.getString(8));
        rs.close();
        cn.close();
        return xpath;
    }

    public Date getLastTime() throws Exception {
        Date d = null;
        Connect cn = null;
        ResultSet rs = null;
        try {
            d = new Date();
            cn = new Connect();
            String sql = "select * from news where categoryid='" + CategoryId + "' order by date desc limit 1";
            rs = cn.execQuery(sql);

            if (!rs.next()) {
                Calendar cal = Calendar.getInstance();
                cal.add(Calendar.DATE, -1);
                String newdate = JOptionPane.showInputDialog("Nhập ngày-giờ bắt đầu lấy tin: ", new SimpleDateFormat("yyyy-MM-dd HH:mm:ss").format(cal.getTime()));
                if (newdate != null) {
                    d = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss").parse(newdate);//1921-01-18 00:00:00
                } else {
                    return null;
                }
            } else {
                d = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss").parse(rs.getString(5));
            }

        } catch (Exception ex) {
            JOptionPane.showMessageDialog(null, ex.getMessage());
        } finally {
            cn.close();
            rs.close();
        }
//        return true;
        return d;
    }

    /**
     *
     * @return true is The First Get else ...
     */
    public Boolean checkFirstGetLink() throws Exception {
        Connect cn = null;
        ResultSet rs = null;
        try {
            cn = new Connect();
            String sql = "select * from news where newsid='" + NewsId + "'";
            rs = cn.execQuery(sql);


            if (!rs.next()) {
                return true;
            }

        } catch (Exception ex) {
            JOptionPane.showMessageDialog(null, ex.getMessage());
        } finally {
            cn.close();
            rs.close();
        }
        return false;
    }

    public void getNews(ArrayList<String> ListLink, ArrayList<String> XPath, Date last) throws Exception {
        Connect cn = null;
        try {
            SimpleDateFormat df = new SimpleDateFormat("yyyy/MM/dd HH:mm");
            String title = "";
            String image = "";
            String des = "";
            String sql = "";
            String s = "";
            Date date;
            Document dc;
            cn = new Connect();
            for (int i = 0; i < ListLink.size(); i++) {
                s = GetContent(ListLink.get(i));
                if (s != "") {
                    dc = Convert(s);
                    date = GetNewsDateTime(dc, XPath.get(3));
                    if (date != null && date.compareTo(last) > 0) {
                        title = GetNewsTitle(dc, XPath.get(1)).replaceAll("'", "");
                        image = GetNewsImage(dc, XPath.get(2));
                        des = GetNewsDescription(dc, XPath.get(4)).replaceAll("'", "");
                        //luu tin xuong csdl
                        sql = "insert news(link,title,image,date,description,categoryid) "
                                + "values(N'" + ListLink.get(i) + "',N'" + title + "','" + image
                                + "','" + df.format(date) + "',N'" + des + "','" + CategoryId + "')";

                        cn.exec(sql);
                    }
                }
            }
        } catch (Exception ex) {
            JOptionPane.showMessageDialog(null, ex.getMessage());
            System.out.println("");
        } finally {
            cn.close();
        }
    }

    private String GetNextLink(String curentLink, String nextlink, String curentlink) {
        XPathFactory xPathfactory = XPathFactory.newInstance();
        XPath xpath = xPathfactory.newXPath();
        XPathExpression expr;
        NodeList nl = null;
        NodeList nl1 = null;
        String lastlink = "";
        try {
            expr = xpath.compile(nextlink);//lay link
            nl = (NodeList) expr.evaluate(Convert(GetContent(curentLink)), XPathConstants.NODESET);
            lastlink = nl.item(nl.getLength() - 1).getAttributes().getNamedItem("href").getNodeValue();

            //Kiem tra co phai la link hay khong
            //Vi thong thuong, link page phai co it nhat 1 dau "/"
            //Neu next page duoc su dung javascript thi se la "#" or "" vd o trang tuoitre.vn
            if (lastlink.split("/").length == 1) {
                expr = xpath.compile(curentlink);//lay link
                nl1 = (NodeList) expr.evaluate(Convert(GetContent(curentLink)), XPathConstants.NODESET);
                String curentPage = nl1.item(nl1.getLength() - 1).getTextContent();
                int i = 0;
                for (; i < nl.getLength(); i++) {
                    Node currentItem = nl.item(i);
                    if (curentPage.equals(currentItem.getTextContent())) {
                        break;
                    }
                }
                lastlink = nl.item(i + 1).getAttributes().getNamedItem("href").getNodeValue();
            }
        } catch (XPathExpressionException ex) {
            JOptionPane.showMessageDialog(null, ex.getMessage());
        } catch (ParserConfigurationException ex) {
            JOptionPane.showMessageDialog(null, ex.getMessage());
        }
        if (!lastlink.contains("http://")) {
            String domain = curentLink.replaceAll("http://", "").replaceAll("www.", "").split("/")[0];
            lastlink = "http://www." + domain + lastlink;
        }
        return lastlink;
    }

    class LayTinThread implements Runnable {

        Thread t;
        String name;

        public LayTinThread(String ThreadName) {
            name = ThreadName;
            t = new Thread(this, name);
            t.start();
        }

        public void run() {
            try {
                if (cbourl.getItemCount() > 0 && cbocategory.getItemCount() > 0) {
                    try {
                        //lay list link
                        ArrayList<String> XPath = GetXPath();
                        int limit = (int) pinLimit.getValue();
                        int count = 0;
                        String link = CategoryLink;
                        Date last = getLastTime();
                        while (count < limit && last != null) {
                            ArrayList<String> ListLink = new ArrayList<>();
                            ListLink = GetNewsLink(link, XPath.get(0));
                            link = GetNextLink(link, XPath.get(5), XPath.get(6));
                            getNews(ListLink, XPath, last);
                            count++;
                        }
                    } catch (Exception ex) {
                        JOptionPane.showMessageDialog(null, ex.getMessage());
                    }
                }
            } catch (Exception ex) {
                System.out.println(name + "-" + ex.getMessage());
            }
        }
    }

    private void SetTxt() {
        txtlinkweb.setText("");
        txtlinkchude.setText("");
        txtlink.setText("");
        txttitle.setText("");
        txtimage.setText("");
        txtdate.setText("");
        txtdes.setText("");
        txtnextlink.setText("");
    }

    private void btntaomoiActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_btntaomoiActionPerformed
        if (!txtlinkweb.getText().equals("") && !txtlinkchude.getText().equals("")) {
            try {
                //save site, xpath and get category
                AnhXa();
                //SetTxt();
                //load data to all combobox
                LoadDataUrl();
            } catch (Exception ex) {
                JOptionPane.showMessageDialog(null, ex.getMessage());
            }
        } else {
            JOptionPane.showMessageDialog(null, "Bạn hãy nhập đầy đủ thông tin!");
        }
    }//GEN-LAST:event_btntaomoiActionPerformed

    protected static ImageIcon createImageIcon(String path) {
        File f = new File(path);
        URL imageURL = null;
        if (!f.exists()) {
            imageURL = ClassLoader.getSystemResource(path);
        } else {
            try {
                imageURL = f.toURL();
            } catch (MalformedURLException ex) {
                JOptionPane.showMessageDialog(null, ex.getMessage());
            }
        }
        if (imageURL != null) {
            return new ImageIcon(imageURL);
        } else {
            //JOptionPane.showMessageDialog(null, "Không thể tìm thấy "+path);
            return null;
        }
    }

    class XemTinThread implements Runnable {

        Thread t;
        String name;

        public XemTinThread(String ThreadName) {
            name = ThreadName;
            t = new Thread(this, name);
            t.start();
        }

        public void run() {
            try {
                Connect cn = new Connect();
                String sql = "select * from news where newsid='" + NewsId + "'";
                ResultSet rs = cn.execQuery(sql);
                if (rs.next()) {
                    CurrentNewsId = rs.getInt(1);
                    txtdiachi.setText(rs.getString(2));
                    txttuade.setText(rs.getString(3));
                    txtngaygio.setText(rs.getString(5));
                    txtmota.setText(rs.getString(6));
                    //final File f = new File(".");
                    final File f = new File(Main.class
                            .getProtectionDomain().getCodeSource().getLocation().getPath());
                    ImageIcon ic = createImageIcon(f.getPath().replace("%20", " ") + "/../../Images/" + rs.getString(4));
                    //ImageIcon ic = createImageIcon(f.getPath().replace("%20", " ") + "/Images/" + rs.getString(4));
                    //JOptionPane.showMessageDialog(null, f.getPath().replace("%20", " ") + "/Images/" + rs.getString(4));
                    if (ic
                            != null) {
                        Image im = ((ic.getImage().getScaledInstance(268, 151, Image.SCALE_SMOOTH)));
                        ic = new ImageIcon(im);
                        lbhinhanh.setIcon(ic);
                    } else {
                        lbhinhanh.setIcon(null);
                    }
                }
                rs.close();
                cn.close();
            } catch (SQLException ex) {
                JOptionPane.showMessageDialog(null, ex.getMessage());
            } catch (Exception ex) {
                JOptionPane.showMessageDialog(null, ex.getMessage());
            }
        }
    }

    private void btnxemtinActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_btnxemtinActionPerformed
        // TODO add your handling code here:
        XemTinThread xtt = new XemTinThread("xemtin");
    }//GEN-LAST:event_btnxemtinActionPerformed

  private void btnXoaActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_btnXoaActionPerformed
      // TODO add your handling code here:
      if (CurrentNewsId != -1) {

          if (JOptionPane.showConfirmDialog(null, "Bạn có chắc muốn xóa?",
                  "Cảnh báo!", JOptionPane.YES_NO_OPTION,
                  JOptionPane.WARNING_MESSAGE) == JOptionPane.YES_OPTION) {
              Connect cn = null;
              ResultSet rs = null;
              try {
                  cn = new Connect();
                  //xoa hinh tai file
                  String sql = "select * from news where newsid='" + CurrentNewsId + "'";
                  rs = cn.execQuery(sql);
                  if (rs.next() && !rs.getString(4).equals("")) {
                      final File fi = new File(Main.class.getProtectionDomain().getCodeSource().getLocation().getPath());
                      File f = new File(fi.getPath().replace("%20", " ") + "/../../Images/" + rs.getString(4));
                      f.delete();
                  }
                  //xoa tin tai csdl
                  sql = "DELETE FROM news WHERE newsid='" + CurrentNewsId + "'";
                  cn.exec(sql);
                  CategoryItem selectedItem =
                          (CategoryItem) cbocategory1.getSelectedItem();
                  LoadDataTitle(selectedItem.getCategoryid());
                  txtdiachi.setText("");
                  txttuade.setText("");
                  txtngaygio.setText("");
                  txtmota.setText("");
                  lbhinhanh.setIcon(null);

                  CurrentNewsId = -1;
              } catch (Exception ex) {
                  JOptionPane.showMessageDialog(null, ex.getMessage());
              } finally {
                  try {
                      rs.close();
                      cn.close();
                  } catch (SQLException ex) {
                      Logger.getLogger(Main.class.getName()).log(Level.SEVERE, null, ex);
                  } catch (Exception ex) {
                      Logger.getLogger(Main.class.getName()).log(Level.SEVERE, null, ex);
                  }
              }
          }
      } else {
          JOptionPane.showMessageDialog(null, "Không có tin được chọn!");
      }
  }//GEN-LAST:event_btnXoaActionPerformed

    private void btlaytinActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_btlaytinActionPerformed
        // TODO add your handling code here:
        LayTinThread ltt = new LayTinThread("laytin");
    }//GEN-LAST:event_btlaytinActionPerformed

    private void btThemChuDeActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_btThemChuDeActionPerformed
        // TODO add your handling code here:
        if (!txtTenChuDe.getText().equals("") && !txtDiaChiChuDe.getText().equals("")) {
            Connect cn = new Connect();
            try {
                UrlItem item=(UrlItem)cbourl3.getSelectedItem();
                String sql = "insert category(name,link,urlid) values(N'" + txtTenChuDe.getText() + "',N'" + txtDiaChiChuDe.getText()
                            + "','" + item.getValue()+ "')";
                cn.exec(sql);
                txtTenChuDe.setText("");
                txtDiaChiChuDe.setText("");
                LoadDataCate(item.getValue());
                LoadDataCate1(item.getValue());
            } catch (Exception ex) {
                JOptionPane.showMessageDialog(null, ex.getMessage());
            }
            finally{
                try {
                    cn.close();
                } catch (Exception ex) {
                    Logger.getLogger(Main.class.getName()).log(Level.SEVERE, null, ex);
                }
            }
        } else {
            JOptionPane.showMessageDialog(null, "Bạn hãy nhập đầy đủ thông tin!");
        }
    }//GEN-LAST:event_btThemChuDeActionPerformed

    /**
     * @param args the command line arguments
     */
    public static void main(String args[]) {
        /* Set the Nimbus look and feel */
        //<editor-fold defaultstate="collapsed" desc=" Look and feel setting code (optional) ">
        /* If Nimbus (introduced in Java SE 6) is not available, stay with the default look and feel.
         * For details see http://download.oracle.com/javase/tutorial/uiswing/lookandfeel/plaf.html 
         */
        try {
            for (javax.swing.UIManager.LookAndFeelInfo info : javax.swing.UIManager.getInstalledLookAndFeels()) {
                if ("Nimbus".equals(info.getName())) {
                    javax.swing.UIManager.setLookAndFeel(info.getClassName());
                    break;


                }
            }
        } catch (ClassNotFoundException ex) {
            java.util.logging.Logger.getLogger(Main.class
                    .getName()).log(java.util.logging.Level.SEVERE, null, ex);
        } catch (InstantiationException ex) {
            java.util.logging.Logger.getLogger(Main.class
                    .getName()).log(java.util.logging.Level.SEVERE, null, ex);
        } catch (IllegalAccessException ex) {
            java.util.logging.Logger.getLogger(Main.class
                    .getName()).log(java.util.logging.Level.SEVERE, null, ex);
        } catch (javax.swing.UnsupportedLookAndFeelException ex) {
            java.util.logging.Logger.getLogger(Main.class
                    .getName()).log(java.util.logging.Level.SEVERE, null, ex);
        }
        //</editor-fold>

        /* Create and display the form */
        java.awt.EventQueue.invokeLater(new Runnable() {
            public void run() {
                Main f = null;
                try {
                    f = new Main();




                } catch (Exception ex) {
                    Logger.getLogger(Main.class
                            .getName()).log(Level.SEVERE, null, ex);
                }
                f.setVisible(true);
                f.setLocationRelativeTo(null);
            }
        });
    }
    // Variables declaration - do not modify//GEN-BEGIN:variables
    private javax.swing.JButton btThemChuDe;
    private javax.swing.JButton btlaytin;
    private javax.swing.JButton btnXoa;
    private javax.swing.JButton btntaomoi;
    private javax.swing.JButton btnxemtin;
    private javax.swing.JComboBox cbocategory;
    private javax.swing.JComboBox cbocategory1;
    private javax.swing.JComboBox cbotitle;
    private javax.swing.JComboBox cbourl;
    private javax.swing.JComboBox cbourl1;
    private javax.swing.JComboBox cbourl2;
    private javax.swing.JComboBox cbourl3;
    private javax.swing.JFrame jFrame1;
    private javax.swing.JFrame jFrame2;
    private javax.swing.JLabel jLabel1;
    private javax.swing.JLabel jLabel10;
    private javax.swing.JLabel jLabel11;
    private javax.swing.JLabel jLabel12;
    private javax.swing.JLabel jLabel13;
    private javax.swing.JLabel jLabel14;
    private javax.swing.JLabel jLabel15;
    private javax.swing.JLabel jLabel16;
    private javax.swing.JLabel jLabel17;
    private javax.swing.JLabel jLabel18;
    private javax.swing.JLabel jLabel19;
    private javax.swing.JLabel jLabel2;
    private javax.swing.JLabel jLabel20;
    private javax.swing.JLabel jLabel21;
    private javax.swing.JLabel jLabel22;
    private javax.swing.JLabel jLabel23;
    private javax.swing.JLabel jLabel24;
    private javax.swing.JLabel jLabel3;
    private javax.swing.JLabel jLabel4;
    private javax.swing.JLabel jLabel5;
    private javax.swing.JLabel jLabel6;
    private javax.swing.JLabel jLabel7;
    private javax.swing.JLabel jLabel8;
    private javax.swing.JLabel jLabel9;
    private javax.swing.JPanel jPanel1;
    private javax.swing.JPanel jPanel3;
    private javax.swing.JPanel jPanel5;
    private javax.swing.JPanel jPanel6;
    private javax.swing.JPanel jPanel7;
    private javax.swing.JScrollPane jScrollPane1;
    private javax.swing.JTabbedPane jTabbedPane6;
    private java.awt.Label label1;
    private javax.swing.JLabel lbhinhanh;
    private javax.swing.JSpinner pinLimit;
    private javax.swing.JTextField txtDiaChiChuDe;
    private javax.swing.JTextField txtTenChuDe;
    private javax.swing.JTextField txtcurentlink;
    private javax.swing.JTextField txtdate;
    private javax.swing.JTextField txtdes;
    private javax.swing.JTextField txtdiachi;
    private javax.swing.JTextField txtimage;
    private javax.swing.JTextField txtlink;
    private javax.swing.JTextField txtlinkchude;
    private javax.swing.JTextField txtlinkweb;
    private javax.swing.JTextArea txtmota;
    private javax.swing.JTextField txtnextlink;
    private javax.swing.JTextField txtngaygio;
    private javax.swing.JTextField txttitle;
    private javax.swing.JTextField txttuade;
    // End of variables declaration//GEN-END:variables
}
